<?php
declare(strict_types=1);
// 默认控制器
namespace app\pos_v1\controller;
class Index
{
    public function index()
    {
        $query = request()->param(); //请求参数
        $apidb = [
            'name' => "XPOS收银",
            '当前应用' => app('http')->getName(),
            'TP版本' => \think\facade\App::version(),
            'PHP版本号' => phpversion(),
            '当前时间' => date('Y-m-d H:i:s', time()),
            '当前请求参数' => $query,
            '获取当前请求的时间' => request()->time(),
            '当前的请求类型' => request()->method(),
            '当前请求的资源类型' => request()->type(),
            '获取客户端IP地址' => request()->ip(),
            '检测是否是合法的IP地址' => request()->isValidIP(request()->ip()),
            // '将IP地址转换为二进制字符串' => request()->ip2bin(request()->ip()),
            '检测是否使用手机访问' => request()->isMobile(),
            '获取当前包含协议的域名' => request()->domain(),
            '获取当前根域名' => request()->rootDomain(),
            '获取当前子域名' => request()->subDomain(),
            '获取当前泛域名的值' => request()->panDomain(),
            '获取当前完整URL 包括QUERY_STRING' => request()->url(),
            '获取当前URL 不含QUERY_STRING' => request()->baseUrl(),
            '获取当前执行的文件 SCRIPT_NAME' => request()->baseFile(),
            '获取URL访问根地址' => request()->root(),
            '获取URL访问根目录' => request()->rootUrl(),
            '获取当前请求URL的pathinfo信息 含URL后缀' => request()->pathinfo(),
            '当前URL的访问后缀' => request()->ext(),
            '当前请求的host' => request()->host(),
            '当前是否ssl' => request()->isSsl(),
            '当前是否JSON请求' => request()->isJson(),
            '当前是否Ajax请求' => request()->isAjax(),
            '当前是否Pjax请求' => request()->isPjax(),
            '设置或者获取当前的Header' => request()->header(),
            // '获取server参数' => request()->server(),
        ];
        return json($apidb);
    }
}
